﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="list.aspx.vb" Inherits="mybaconrecipeprototype.list" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <h1>Recipe List</h1>
    </p>
    <p>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            AllowSorting="True"
        DataKeyNames="ID" DataSourceID="SqlDataSource1" CellPadding="0" 
            AllowPaging="True">
        <AlternatingRowStyle CssClass="altRow" />
        <Columns>

            <asp:TemplateField HeaderText="Photo">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "details.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Photo") %>' class="recipePhoto" />
                    </asp:HyperLink>
                </ItemTemplate>
                <ControlStyle CssClass="list_col1Item" />
            </asp:TemplateField>

            <asp:BoundField DataField="RecipeName" HeaderText="RecipeName" 
                SortExpression="RecipeName" >
            <ControlStyle CssClass="list_col2Item" />
            </asp:BoundField>
            <asp:BoundField DataField="Rating" HeaderText="Rating" 
                SortExpression="Rating" >
            <ControlStyle CssClass="list_col3Item" />
            </asp:BoundField>
            <asp:BoundField DataField="CookingTime" HeaderText="CookingTime" 
                SortExpression="CookingTime" >
            <ControlStyle CssClass="list_col4Item" />
            </asp:BoundField>
            <asp:BoundField DataField="ShortDescription" HeaderText="ShortDescription" 
                SortExpression="ShortDescription" >
            <ControlStyle CssClass="list_col5Item" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="details.aspx?ID={0}" HeaderText="More Detail" 
                Text="Read More" >

            <ControlStyle CssClass="list_col6Item" />
            </asp:HyperLinkField>

        </Columns>
        <HeaderStyle CssClass="gridHeader" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:mbrConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:mbrConnectionString.ProviderName %>" 
        
            SelectCommand="SELECT [ID], [RecipeName], [Rating], [CookingTime], [ShortDescription], [Ingredients], [CookingMethod], [Photo], [RecipeSource] FROM [recipes]">
    </asp:SqlDataSource>
    </p>
    <p>
        &nbsp;</p>
</asp:Content>
